CiscoXaaSAPI

(0 reviews)

PHP - Code Sample

NOTE: These are code samples provided for a conceptual understanding. Please do not copy / paste directly.

Request / Response

Create Subscription


<?php

$request = new HttpRequest();
$request->setUrl('https://apx.cisco.com/ccw/api/v1.0/subscription');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'content-type' => 'application/json',
  'authorization' => 'Bearer upbNQ1tPiEnpSUrj82qHaHDwNOtg'
));

$request->setBody('{
  "uuid": "test_order123123123123",
  "createdBy": "user_id",
  "createdDateTime": "2017-02-17T01:25:43.000+0000",
  "csbSubscriptionId": "csbSubtest123",
  "csbOrderId": "csbSubOrderTest123",
  "purchaseOrderNumber": "PO12345678",
  "billingAddressId": 403766138,
  "currency": "USD",
  "paymentMethod": "NET30",
  "rejectDuplicatePO": "Y",
  "governmentOrder": "N",
  "intialTerm": 12,
  "autoRenewalTerm": 12,
  "billingModel": "Monthly Billing",
  "requestedStartDate": "2017-03-01",
  "parties": [
    {
      "partyType": "End Customer",
      "partyName": "Customer_Name",
      "addressLine1": "Customer_Address",
      "city": "Customer_Address_City",
      "state": "Customer_Address_State",
      "postalCode": "94043",
      "country": "US",
      "businessContactName": "First Last",
      "businessContactEmail": "firstlast@customeremail.com",
      "businessContactTelephone": "444-555-6666"
    },
    {
      "partyType": "Reseller",
      "partyName": "Reseller_Name",
      "addressLine1": "Reseller_Address",
      "accountNumber": "21472846",
      "city": "Reseller_Address_city",
      "state": "Reseller_Address_State",
      "postalCode": "70507",
      "country": "US",
      "businessContactName": "First Last",
      "businessContactEmail": "firstlast@reselleremail.com",
      "businessContactTelephone": "111-222-3344"
    }
  ],
  "offers": [
    {
      "lineNumber": 1,
      "offerSKU": "A-SPK-NU-M3",
      "offerATO": "A-SPK-NAMED-USER",
      "quantity": 1,
      "csbCiscoKey": "2163146462363366067",
      "provisioningAttributes": [
        {
          "attributeIdentifier": "9331",
          "attributeName": "Common.Contacts.END CUSTOMER EMAIL",
          "attributeValue": "endcust@customeremail.com"
        },
        {
          "attributeIdentifier": "8754",
          "attributeName": "Common.Contacts.PARTNER ADMIN EMAIL",
          "attributeValue": "partner@partneremail.com"
        },
        {
          "attributeIdentifier": "6376",
          "attributeName": "Common.Contacts.RESELLER ADMIN EMAIL",
          "attributeValue": "reseller@reselleremail.com"
        },
        {
          "attributeIdentifier": "41319",
          "attributeName": "Site.Webex CMR.SERVICE ENABLED",
          "attributeValue": "false"
        },
        {
          "attributeIdentifier": "65958",
          "attributeName": "Site.Webex Core.TIME ZONE",
          "attributeValue": "(GMT -08:00) PACIFIC TIME,USA & CANADA"
        },
        {
          "attributeIdentifier": "65959",
          "attributeName": "Site.Webex Core.SERVICE URL",
          "attributeValue": "endcustomertest123.webex.com"
        },
        {
          "attributeIdentifier": "65612",
          "attributeName": "Site.Webex Core.COUNTRY CODE",
          "attributeValue": "US"
        },
        {
          "attributeIdentifier": "65960",
          "attributeName": "Site.Webex Core.PRIMARY LANGUAGE",
          "attributeValue": "en_US"
        },
        {
          "attributeIdentifier": "9217",
          "attributeName": "Common.Webex Common.ADMIN EMAIL",
          "attributeValue": "custadmin@customeremail.com"
        },
        {
          "attributeIdentifier": "66123",
          "attributeName": "Common.Webex Common.ADMIN LAST NAME",
          "attributeValue": "CustLName123"
        },
        {
          "attributeIdentifier": "9220",
          "attributeName": "Common.Webex Common.ADMIN FIRST NAME",
          "attributeValue": "CustFName123"
        },
        {
          "attributeIdentifier": "8451",
          "attributeName": "Common.Webex Common.ORGANIZATION NAME",
          "attributeValue": "CustomerOrginization123"
        },
        {
          "attributeIdentifier": "65769",
          "attributeName": "Common.Webex Common.ADMIN PHONE NUMBER",
          "attributeValue": "1231231234"
        },
        {
          "attributeIdentifier": "8952",
          "attributeName": "Site.Webex Conferencing.SERVICE ENABLED",
          "attributeValue": "TRUE"
        },
        {
          "attributeIdentifier": "9083",
          "attributeName": "Site.Webex Core.ADDITIONAL LANGUAGES",
          "attributeValue": ""
        },
        {
          "attributeIdentifier": "8821",
          "attributeName": "Site.Webex Brand.BRANDING REF",
          "attributeValue": ""
        }
      ],
      "offerDescription": "Cloud Calling and Business Messaging (1)"
    }
  ],
  "tncacceptance": "Y"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>

Change Subscription


<?php

$request = new HttpRequest();
$request->setUrl('https://apx.cisco.com/ccw/api/v1.0/subscription');
$request->setMethod(HTTP_METH_PUT);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'authorization' => 'Bearer oHRRke8kZ2CCYHskPGpEcwaREdEP',
  'content-type' => 'application/json'
));

$request->setBody('{
    "uuid": "test_order123123123123",
    "createdBy": "user_id",
    "createdDateTime": "2017-02-17T01:25:43.000+0000",
    "csbSubscriptionId": "csbSubtest123",
    "csbOrderId": "csbSubOrderTest123",
    "purchaseOrderNumber": "PO_80459464",
    "subscriptionId": "Sub1003363",
    "billingAddressId": 403766138,
    "currency": "USD",
    "paymentMethod": "NET30",
    "rejectDuplicatePO": "Y",
    "governmentOrder": "N",
    "intialTerm": 48.0,
    "autoRenewalTerm": 12.0,
    "billingModel": "Monthly Billing",
    "requestedStartDate": "2017-03-01",
    "offers": [{
        "lineNumber": 1,
        "offerSKU": "A-SPK-NU-M3",
        "quantity": 1,
        "csbCiscoKey": "2163146462363366067",
        "provisioningAttributes": [{
            "attributeIdentifier": "9331",
            "attributeName": "Common.Contacts.END CUSTOMER EMAIL",
            "attributeValue": "endcust@customeremail.com"
        }, {
            "attributeIdentifier": "8754",
            "attributeName": "Common.Contacts.PARTNER ADMIN EMAIL",
            "attributeValue": "partner@partneremail.com"
        }, {
            "attributeIdentifier": "6376",
            "attributeName": "Common.Contacts.RESELLER ADMIN EMAIL",
            "attributeValue": "reseller@reselleremail.com"
        }, {
            "attributeIdentifier": "41319",
            "attributeName": "Site.Webex CMR.SERVICE ENABLED",
            "attributeValue": "false"
        }, {
            "attributeIdentifier": "65958",
            "attributeName": "Site.Webex Core.TIME ZONE",
            "attributeValue": "(GMT -08:00) PACIFIC TIME,USA & CANADA"
        }, {
            "attributeIdentifier": "65959",
            "attributeName": "Site.Webex Core.SERVICE URL",
            "attributeValue": "endcustomertest12345.webex.com"
        }, {
            "attributeIdentifier": "65612",
            "attributeName": "Site.Webex Core.COUNTRY CODE",
            "attributeValue": "US"
        }, {
            "attributeIdentifier": "65960",
            "attributeName": "Site.Webex Core.PRIMARY LANGUAGE",
            "attributeValue": "en_US"
        }, {
            "attributeIdentifier": "9217",
            "attributeName": "Common.Webex Common.ADMIN EMAIL",
            "attributeValue": "custadmin@customeremail.com"
        }, {
            "attributeIdentifier": "66123",
            "attributeName": "Common.Webex Common.ADMIN LAST NAME",
            "attributeValue": "CustLName123"
        }, {
            "attributeIdentifier": "9220",
            "attributeName": "Common.Webex Common.ADMIN FIRST NAME",
            "attributeValue": "CustFName123"
        }, {
            "attributeIdentifier": "8451",
            "attributeName": "Common.Webex Common.ORGANIZATION NAME",
            "attributeValue": "CustomerOrginization123"
        }, {
            "attributeIdentifier": "65769",
            "attributeName": "Common.Webex Common.ADMIN PHONE NUMBER",
            "attributeValue": "1231231234"
        }, {
            "attributeIdentifier": "8952",
            "attributeName": "Site.Webex Conferencing.SERVICE ENABLED",
            "attributeValue": "TRUE"
        }, {
            "attributeIdentifier": "9083",
            "attributeName": "Site.Webex Core.ADDITIONAL LANGUAGES",
            "attributeValue": ""
        }, {
            "attributeIdentifier": "8821",
            "attributeName": "Site.Webex Brand.BRANDING REF",
            "attributeValue": ""
        }],
        "offerDescription": "Cloud Calling and Business Messaging (1)"
    }],
    "tncacceptance": "Y"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>

Cancel Subscription


<?php

$request = new HttpRequest();
$request->setUrl('https://apx.cisco.com/ccw/api/v1.0/subscription/cancel');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'content-type' => 'application/json',
  'authorization' => 'Bearer 3ucpq0Mk3BxF0EIzaaInAncqCxhE'
));

$request->setBody('{
    "uuid": "testCancelSubscription_16FEB17_01",
    "createdBy": "user_id",
    "createdDateTime": "2017-02-16T18:25:43-05:00",
    "csbSubscriptionId": "Sub02162017-01",
    "csbOrderId": "Order02162017-01",
    "purchaseOrderNumber": "testCancelSubscription_16FEB17_01",
    "subscriptionId": "Sub1000618",
    "billingAddressId": 403766138,
    "cancelReason": "Adoption: Lack of Internal Support / Lost Sponsor",
    "cancelCode": "20~Adoption~Lack of Documentation"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>

Provisioning Validate


<?php

$request = new HttpRequest();
$request->setUrl('https://apx.cisco.com/ccw/api/v1.0/provisioning/validate');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'content-type' => 'application/json',
  'authorization' => 'Bearer pIJGFTSTXzLX1LgOHp3O0QotXWkE'
));

$request->setBody('{
    "uuid": "test_order123123123123",
    "createdBy": "user_id",
    "createdDateTime": "2017-02-17T01:25:43.000+0000",
    "csbSubscriptionId": "csbSubtest123",
    "csbOrderId": "csbSubOrderTest123",
    "purchaseOrderNumber": "PO123456",
    "billingAddressId": 123123,
    "billingAddressName": "Billing_Party_Name_Here",
    "currency": "USD",
    "paymentMethod": "NET30",
    "rejectDuplicatePO": "Y",
    "governmentOrder": "N",
    "intialTerm": 12.0,
    "autoRenewalTerm": 12.0,
    "billingModel": "Monthly Billing",
    "requestedStartDate": "2017-03-01",
    "parties": [{
        "partyType": "End Customer",
        "partyName": "Customer_Name",
        "addressLine1": "Customer_Address",
        "city": "Customer_Address_City",
        "state": "Customer_Address_State",
        "postalCode": "94043",
        "country": "US",
        "businessContactName": "First Last",
        "businessContactEmail": "firstlast@customeremail.com",
        "businessContactTelephone": "444-555-6666"
    }, {
        "partyType": "Reseller",
        "partyName": "Reseller Name",
        "accountNumber": "21472846",
        "addressLine1": "Reseller_Address",
        "city": "Reseller_Address_City",
        "state": "Reseller_Address_State",
        "postalCode": "70507",
        "country": "US",
        "businessContactName": "First Last",
        "businessContactEmail": "firstlast@customeremail.com",
        "businessContactTelephone": "111-222-3344"
    }],
    "offers": [{
        "lineNumber": 1,
        "offerSKU": "A-SPK-NU-M3",
        "quantity": 1,
        "csbCiscoKey": "2163146462363366067",
        "provisioningAttributes": [{
            "attributeIdentifier": "9331",
            "attributeName": "Common.Contacts.END CUSTOMER EMAIL",
            "attributeValue": "endcust@customeremail.com"
        }, {
            "attributeIdentifier": "8754",
            "attributeName": "Common.Contacts.PARTNER ADMIN EMAIL",
            "attributeValue": "partner@partneremail.com"
        }, {
            "attributeIdentifier": "6376",
            "attributeName": "Common.Contacts.RESELLER ADMIN EMAIL",
            "attributeValue": "reseller@reselleremail.com"
        }, {
            "attributeIdentifier": "41319",
            "attributeName": "Site.Webex CMR.SERVICE ENABLED",
            "attributeValue": "false"
        }, {
            "attributeIdentifier": "65958",
            "attributeName": "Site.Webex Core.TIME ZONE",
            "attributeValue": "(GMT -08:00) PACIFIC TIME,USA & CANADA"
        }, {
            "attributeIdentifier": "65959",
            "attributeName": "Site.Webex Core.SERVICE URL",
            "attributeValue": "endcustomertest123.webex.com"
        }, {
            "attributeIdentifier": "65612",
            "attributeName": "Site.Webex Core.COUNTRY CODE",
            "attributeValue": "US"
        }, {
            "attributeIdentifier": "65960",
            "attributeName": "Site.Webex Core.PRIMARY LANGUAGE",
            "attributeValue": "en_US"
        }, {
            "attributeIdentifier": "9217",
            "attributeName": "Common.Webex Common.ADMIN EMAIL",
            "attributeValue": "custadmin@customeremail.com"
        }, {
            "attributeIdentifier": "66123",
            "attributeName": "Common.Webex Common.ADMIN LAST NAME",
            "attributeValue": "CustLName123"
        }, {
            "attributeIdentifier": "9220",
            "attributeName": "Common.Webex Common.ADMIN FIRST NAME",
            "attributeValue": "CustFName123"
        }, {
            "attributeIdentifier": "8451",
            "attributeName": "Common.Webex Common.ORGANIZATION NAME",
            "attributeValue": "CustomerOrginization123"
        }, {
            "attributeIdentifier": "65769",
            "attributeName": "Common.Webex Common.ADMIN PHONE NUMBER",
            "attributeValue": "1231231234"
        }, {
            "attributeIdentifier": "8952",
            "attributeName": "Site.Webex Conferencing.SERVICE ENABLED",
            "attributeValue": "TRUE"
        }, {
            "attributeIdentifier": "9083",
            "attributeName": "Site.Webex Core.ADDITIONAL LANGUAGES",
            "attributeValue": ""
        }, {
            "attributeIdentifier": "8821",
            "attributeName": "Site.Webex Brand.BRANDING REF",
            "attributeValue": ""
        }],
        "offerDescription": "Cloud Calling and Business Messaging (1)"
    }],
    "tncacceptance": "Y"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

?>

Get Status


<?php

$request = new HttpRequest();
$request->setUrl('https://apx.cisco.com/ccw/api/v1.0/subscription/status');
$request->setMethod(HTTP_METH_GET);

$request->setQueryData(array(
  'csbSubscriptionId' => 'csbSubtest123'
));

$request->setHeaders(array(
  'content-type' => 'application/json',
  'cache-control' => 'no-cache',
  'authorization' => 'Bearer oHRRke8kZ2CCYHskPGpEcwaREdEP'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

Reviews